/**
 * Component is an interface that gives the necessary methods to all the component of a circuit.
 * Like the gates, input, output and wire.
 * 
 * @author Simone D'Avico (simone.davico@usi.ch); Giuseppe Mendola (giuseppe.mendola@usi.ch);Gregory Banfi (gregory.banfi@usi.ch);
 * @version 18.05.2011
 */

package ch.usi.inf.pf2;

import java.awt.Color;
import java.awt.Graphics;
import java.io.Serializable;
import java.util.ArrayList;

import ch.usi.inf.pf2.pins.InputPin;
import ch.usi.inf.pf2.pins.OutputPin;

public interface Component extends Serializable  {
	
	public abstract void add(Component component);
	public abstract void remove(Component component);
	
	/**
	 * Methods for GUI
	 */
	public abstract void draw(Graphics g, Color color);
    public abstract boolean contains(int x, int y);
    public abstract int getOriginX();
    public abstract int getOriginY();
    public abstract Value getValue();
    public abstract void setValue(Value value);
    public abstract void setInputPins(ArrayList<InputPin> inputPins);
    public abstract void setOutputPin(OutputPin outputPin);
	public abstract int getFirstFreePin();
	public abstract boolean hasFreePins();
	public abstract void setOrigin(int x, int y);
	public abstract void addInConnectedWire(Wire wire);
	public abstract ArrayList<Wire> getInConnectedWires();
	public abstract void addOutConnectedWire(Wire wire);
	public abstract ArrayList<Wire> getOutConnectedWires();
	public abstract ArrayList<InputPin> getInputPins();
	public OutputPin compute(ArrayList<InputPin> inputPins);
	public abstract OutputPin getOutputPin();
	public abstract InputPin getInputPin();
	public abstract void setOutputValue();
}
